<script setup lang="ts">
    interface Props {
        name?: string
        label?: string
        required?: boolean
        placeholder?: string
    }

    withDefaults(defineProps<Props>(), {
        name: '',
        label: '',
        required: true,
        placeholder: '',
    })

    const value = defineModel()
</script>

<template>
    <a-form-item
        :name="name"
        :label="label"
        :validate-trigger="['']"
        :label-col="{ span: 4 }"
        :wrapper-col="{ span: 14 }"
        :rules="[
            {
                required,
                message: `${label || name}不能为空`,
            },
        ]"
    >
        <a-input
            v-model:value.trim="value"
            :placeholder="placeholder"
        />
    </a-form-item>
</template>

<style scoped lang="less"></style>
